//
//  HRDebitNoteViewController.m
//  haierapp
//
//  Created by Xia Zhiyong on 14-8-14.
//  Copyright (c) 2014年 haier. All rights reserved.
//

#import "HRDebitNoteViewController.h"

@interface HRDebitNoteViewController ()

@end

@implementation HRDebitNoteViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    if (__CUR_IOS_VERSION >= __IPHONE_7_0)
    {
        self.edgesForExtendedLayout= UIRectEdgeNone;
    }
    self.navigationItem.title = @"发票抬头";
    _textView.placeholder = @"请输入公司抬头";
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - textView
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
    
    if ([text isEqualToString:@"\n"]) {
        [textView resignFirstResponder];
        return NO;
    }
    return YES;
}


- (IBAction)actionSure:(id)sender {
    if (_textView.text.length == 0) {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"请输入单位抬头" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles: nil];
        [alert show];
        return;
    }
    if (_ChooseNote) {
        _ChooseNote(_textView.text);
    }
    [self.navigationController popViewControllerAnimated:YES];
}
@end
